1. Field of the Invention
The invention relates in general to a data storage technique, and more particularly to a data storing method and apparatus applied to a flash memory storage device.
2. Description of the Related Art
Current electronic products are basically equipped with a storage device. Common storage devices include a flash memory and an electrically erasable programmable read-only memory (EEPROM), both of which have their pros and cons.
A flash memory is greatly advantaged by having a large capacity and a low cost. However, it suffers from disadvantages of providing a slow erasing and writing speed. In each erasing and writing process, erasing is first performed before the flash memory can be written to, and a smallest unit is one bank comprising 64 KB. In addition, each storage unit is only readable/writeable for a around a barely satisfactory number of 100 thousand times.
An EEPROM is compromised by a drawback of having a small capacity and a high cost. Yet, it contributes advantages of having a fast erasing and writing speed. Each erasing and writing process can be performed in a unit of one byte, and each unit is readable/writable up to a million times.
At least two types of data needs to be stored when a data storage device stores data—program data and user data. When a storage device is shipped out of the factory, the program data usually stays unchanged unless a software upgrade is needed. Therefore, a flash memory is commonly used as a storage device for program data. In contrast, since user data is frequently modified, a corresponding storage device needs to meet higher requirements of readable/writable number of times and stability.
Again, following issues arise when a flash memory is adopted for storing user data based on cost concerns. As previous stated, a flash memory has a slow erasing and writing speed, and a minimum unit for erasing and writing of most Serial Peripheral Interface (SPI) flash memories is a bank comprising 64 KB that takes more than 100 ms for each erasing process. Further, excessive erasing processes not only inevitably have undesirable effects on a lifespan of a flash memory but also slow down a speed of data storing.